{include file="common/_meta" /}

<link href="/static/admin/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-article-add">
		<input type="text" name="id" value="{$info.id|default=0}" style="display: none;;">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>公告标题：</label>
			<div class="formControls col-xs-8 col-sm-9 col-md-5">
				<input type="text" class="input-text" value="{$info.n_title|default=''}" placeholder="" id="n_title" name="n_title">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">类别：</label>
			<div class="formControls col-xs-8 col-sm-9 col-md-5">
				<select class="input-text" id="n_keywords" name="n_keywords">
					<option value='0' {if isset($info)}{if condition="$info.n_keywords"} {$info.n_keywords==0?"selected":""} {/if}{/if} >官方公告</option>
					<option  {if isset($info)}{if condition="$info.n_keywords"} {$info.n_keywords==1?"selected":""} {/if}{/if} value ='1'>行业动态</option>
					<option {if isset($info)}{if condition="$info.n_keywords"} {$info.n_keywords==2?"selected":""} {/if}{/if} value='2'>新闻资讯</option>
				</select>
				<!-- <input type="text" class="input-text" value="{$info.n_keywords|default=''}" placeholder="可为空..." id="n_keywords" name="n_keywords"> -->
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-2">详细内容：</label>
			<div class="formControls col-xs-8 col-sm-9 col-md-5"> 
				<textarea id="editor" type="text/plain" name="n_message" style="width:100%;height:300px;">{$info.n_message|default=''}</textarea>
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
				<button onClick="return savePro();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 发布</button>
				<!-- <button onClick="layer_close();" class="btn btn-default radius" type="reset">&nbsp;&nbsp;取消&nbsp;&nbsp;</button> -->
			</div>
		</div>
	</form>
</div>

{include file="common/_footer" /}

<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="/static/admin/lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">


$(function(){
	var ue = UE.getEditor('editor', {toolbars: [
    ['source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'fontfamily', 'fontsize', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'forecolor', 
        'backcolor', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
	]});
});

function savePro(){

	var title = $('#n_title').val();
	var message = $('#n_message').val();

	if (title == '' || message == '') {
		layer.msg('标题或内容不能为空');
		return false;
	}

    $.post('{:url("Notice/issueNotice")}',$('#form-article-add').serialize()).success(function(data){
    	layer.msg(data.msg);
    	if(data.code){
    		setTimeout(function(){
    			location.href = '{:url("Notice/index")}';
    		},500);
    	}
    });
    return false;
}

</script>
</body>
</html>